<?php

namespace App\Jobs\Controller;

use App\Common\Libs\HttpClient;
use App\Jobs\BaseJob;

class RecommendSystemJob extends BaseJob
{
    /**
     * 推送【内容】到推荐系统
     * @param $msgContent
     * @return bool
     */
    public function addTarget($msgContent)
    {
        $recommendViewUrl = service()->ConfigService->getConfigByKey('recommendImportUrl');

        HttpClient::getInstance()->post($recommendViewUrl, $msgContent['msgContent']);

        return true;
    }

    /**
     * 推送【浏览记录】到推荐系统
     * @param $msgContent
     * @return bool
     */
    public function addView($msgContent)
    {
        $recommendViewUrl = service()->ConfigService->getConfigByKey('recommendViewUrl');

        HttpClient::getInstance()->post($recommendViewUrl, $msgContent['msgContent']);

        return true;
    }

    /**
     * 从推荐系统移除
     * @param $msgContent
     * @return bool
     */
    public function remove($msgContent)
    {
        $recommendRemoveUrl = service()->ConfigService->getConfigByKey('recommendRemoveUrl');

        HttpClient::getInstance()->get($recommendRemoveUrl, $msgContent['msgContent']);

        return true;
    }
}
